<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
	var request=new XMLHttpRequest();
	request.onreadystatechange=function()
	{
	    if (request.readyState==4 && request.status==200)
	    {
	        console.log(request.responseText);
	        var div=document.getElementById("info");
	        div.innerHTML=request.responseText;
	    }else if(request.readyState==404){
	    	console.log("登录失败！");
	    	var div=document.getElementById("info");
	    	div.innerHTML="登录失败！";
	    }
	    
	}
	function check(){
		request.open("post","LoginServlet",true);
		request.setRequestHeader( "Content-Type",
		 "application/x-www-form-urlencoded" );
		var name=document.getElementById("userName").value;
		var pwd=document.getElementById("passWord").value;
		request.send("userName="+name+"&passWord="+pwd);
	}
</script>
</head>
<body>
		用户名:<input type="text" id="userName" name="userName"><br>
		密码:<input type="password" id="passWord" name="passWord"><br>
		<input type="button" onclick="check()" value="验证" >
	<div id="info"></div>
</body>
</html>